<?php
###############   COPYLEFT GPLv3 LICENSE   ###############
##
## JFX Version 0.2.9
## Website Management Software
## www.jfxcms.com
##
## Copyright 2009 GPLv3 - http://www.opensource.org/licenses/gpl-3.0.html
##
## Anthony Gallon
## oi_antz@hotmail.com
##
## Permission is hereby granted to any person having a copy of this software
## to freely use and modify as required so long as the copyright notices
## and branding remain intact.
##
## Full license details available at http://www.jfxcms.com/license
##
###############   COPYLEFT GPLv3 LICENSE   ###############


if($this->checkPermission('perm_users')
    || $this->checkPermission('perm_groups')
    ){

    $menu = $params['menu'];

    $users = $menu->findRecursive('user-management');

    if(!is_object($users) || false === ($users instanceof JFX_Theme_Menu)){
        $users = $menu->addItem(count($menu->getItems()), 'user-management', $this->lang('user_mgmt'));
    }


    // customer management
    $cust = $users->addItem(count($users->getItems()), 'iusers-section', $this->lang('cust_mgmt'));

    if($this->checkPermission('perm_users')){
        // search
        $url = $this->adminUrl.'/view/';
        $icon = $CONFIG->imageUrl.'/admin/icons/show.png';
        $i = $cust->addItem(0, 'iusers-view', $this->lang('search_customers'), $url, $icon);
    }

    if($this->checkPermission('perm_users')){
        // new
        $url = $this->adminUrl.'/new/';
        $icon = $CONFIG->imageUrl.'/admin/icons/person4.png';
        $i = $cust->addItem(1, 'iusers-view', $this->lang('new_customer'), $url, $icon);
    }

    if($this->checkPermission('perm_groups')){
        // groups
        $url = $this->adminUrl.'/groups/';
        $icon = $CONFIG->imageUrl.'/admin/icons/key-silver.png';
        $i = $cust->addItem(2, 'iusers-view', $this->lang('customer_groups'), $url, $icon);
    }
}




if($this->checkPermission('perm_config') || $this->checkPermission('perm_places')){


    $conf = $menu->findRecursive('system-configuration');

    if(!is_object($conf) || false === ($conf instanceof JFX_Theme_Menu)){
        $conf = $menu->addItem(count($menu->getItems()), 'system-configuration', $this->lang('sys_config'));
    }

    if($this->checkPermission('perm_config')){
        $url = $this->adminUrl.'/config/';
        $icon = $CONFIG->imageUrl.'/admin/icons/tools.gif';
        $i = $cust->addItem(count($conf->getItems()), 'iusers-config', $this->lang('cust_config'), $url, $icon);
    }

    if($this->checkPermission('perm_places')){
        $url = $this->adminUrl.'/places/';
        $icon = $CONFIG->imageUrl.'/admin/icons/home.png';
        $i = $cust->addItem(count($conf->getItems()), 'iusers-places', $this->lang('cust_places'), $url, $icon);
    }


}

















